/**
 * 
 */
package com.shop.mappers;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.shop.entities.User;

/**
 * @author skatam
 *
 */
public interface UserMapper {
	
	@Select("select user_id as userId, username as userName from user where user_id=#{userId}")
	public User findUserById(Integer userId);
	
	@Select("select user_id as userId, username as userName from user")
	public List<User> findAllUsers();
	
	
	@Update("update user set username = #{userName},password =#{password},level=#{level} where user_id = #{userId}")
	public void update(User u);
	
		
	@Delete("delete from user where user_id = #{userId}")
	public void delete(User u);
	
	
	//@Insert("insert into user (userName,password,level) values(#{userName},#{password},#{level})")
	public void add(User u);
	
	
	
}
